Device for dynamically varying the priority of various processing in a printer

ABSTRACT

An image can be smoothly generated without delaying the release of a host by dynamically changing the priority of a task for writing to a hard disk for the priority of another task. The dynamic varying of the priorities of the different types of tasks is dependent upon predetermined events or triggers, which thereby prevents the release delay of a host, so that successive images can be smoothly generated.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a Continuation Application of U.S. application Ser. No.09/522,407 filed Mar. 9, 2000; the entire disclosure of which isincorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a printer, a printer control method anda record medium for recording a program. In more detail, the presentinvention relates to a printer provided with an auxiliary storage suchas a hard disk (HD) separately from a buffer memory, a printer controlmethod and a record medium for recording a program.

The present application is based on Japanese Patent Application No. Hei.11-63877, which is incorporated herein by reference.

2. Description of the Related Art

A conventional type printer stores print job data from a host computerin a receive buffer, sequentially interprets data stored in the receivebuffer, generates image data for printing and output and prints it. Assuch a printer has only to sequentially interpret and print as describedabove, a so-called local printer has only to have a memory enough totemporarily store data for one band or one page for example according tothe format of its print engine.

However, recently, as the coloring, enhancing the resolution and othersof a printed document are promoted as a computer, image processingtechnology and others develop, the quantity of print job data increases.In the case of a network printing system that plural host computersshare a printer via a network such as a local area network (LAN), printjob data from plural host computers is required to be successivelyprocessed.

If a memory mounted in a printer has only capacity for one page, a hostcomputer which desires a document for a few hundred pages to be printedis required to continue to send print job data for a long time. Theother many host computers connected via the network are required to waitfor a long time.

A printer provided with an auxiliary storage such as HD inside theprinter so that received data is stored in the auxiliary storage so asto store enormous print job data promptly and release a host computerearly is proposed recently. In this specification, the above auxiliarystorage is not limited to HD, includes various recording devices using arecord medium such as an optical record medium and a magneto-opticrecord medium and means a storage speed for writing and reading datato/from which is slower than a conventional type buffer memory, that is,RAM. At least, the reduction of speed caused by an access of a head to arecord medium such as a disk is caused by the above auxiliary storage.For an example of the auxiliary storage, a case using HD will bedescribed below.

As a large quantity of data can be stored in a printer utilizing theabove auxiliary storage, a host computer can be released early. However,as data is read or written by moving a head to a predetermined positionon a rotated storage medium in HD used for an auxiliary storage, speedfor reading or writing data is slower than that in case a memory such asa random access memory (RAM) is accessed. For example, normally, even ifspeed for receiving data from a network is 1 to 2 MB/second andprocessing speed in an image data generation section is 1 MB/second, thedata transfer rate of HD is approximately 500 kB/second and is slow.

Therefore, in the case of only the transfer of print job data via anauxiliary storage, it takes much time to write and read to/from theauxiliary storage, and thus printing processing is greatly delayed. Inthis case, if a high speed interface, DMA and others are adopted, thedata transfer rate of an auxiliary storage is enhanced, however, thecost of a printer is increased.

In the meantime, if printing processing is preceded and processing forwriting and reading to/from an auxiliary storage is left until later,speed for receiving from a network is greatly reduced and the release ofa host computer is delayed.

SUMMARY OF THE INVENTION

The present invention is made in view of such problems. That is, theobject is to provide a printer wherein prompt printing processing andthe prompt release of a host computer are compatible by dynamicallyvarying the priority of various processing required for printingprocessing in the printer, a printer control method and a record mediumfor recording a program.

To achieve the above object, a printer according to the presentinvention is based upon a printer provided with an auxiliary storage andis characterized in that a printing task for executing processingrelated to the control of a print engine based upon a request forprinting, an image generation task for generating the above request forprinting based upon print data sent from an external device, a task forwriting to an auxiliary storage that data related to printing is storedin the auxiliary storage and a task for reading from the auxiliarystorage that the above data stored in the auxiliary storage is read areexclusively selected and executed according to each priority, andfurther the relative order of priority based upon the priority of theabove task for writing to the auxiliary storage and the priority of theabove image generation task is varied when a predetermined event occurs.

If the order of priority is varied as described above, CPU can beallocated to each task in a well-balanced state and efficient processingis enabled as the whole printer.

A print engine can be smoothly operated by applying lower priority thanthe priority of the above printing task to the above task for writing tothe auxiliary storage and the above task for reading from the auxiliarystorage and particularly, if an engine of a laser printer is used,extremely prompt printing is also enabled.

It is desirable that the above predetermined event occurs whenpredetermined time elapses. That is, priority is varied by a method suchas timer interrupt and efficient processing is extremely easilyrealized.

Or the above predetermined event may be also the occurrence of apredetermined situation which occurs in the processing of any task. Thatis, according to a situation under which a task is processed, CPU can beefficiently allocated to each task that determines the rate of the wholeprocessing.

Further, the above predetermined event may be also made to occuraccording to the quantity of requests for printing generated by theabove image generation task and stored to be processed by the aboveprinting task. If so, data can be efficiently written to the auxiliarystorage, continuously operating the print engine and a host computer canbe released early.

Further, priority lower than the priority of the above task for readingfrom the auxiliary storage may be also applied to the above task forwriting to the auxiliary storage. If so, data can be written to theauxiliary storage without limiting the rate of reading processing.

Further, a printer according to the present invention is based upon aprinter provided with an auxiliary storage for storing data related toprinting, a print engine for executing printing and a controller and ischaracterized in that the above controller comprises writing means forstoring data to an auxiliary storage, reading means for reading the datastored in the auxiliary storage, image generation means for generating arequest for printing supplied to a print engine and printing executionmeans for controlling the print engine and if a predetermined eventoccurs during processing for generating the request for printing by theabove image generation means, the writing means is executed moreprecedently than the generation of the request for printing by the imagegeneration means, and prompt printing and the early release of a hostcomputer are compatible.

If data related to printing stored in the auxiliary storage in any ofthe above printers includes print data sent from an external device,print data received via a network can be stored in large quantity and ahost computer can be released early.

Or if data related to printing stored in the auxiliary storage includesat least a part of the above request for printing, a large quantity ofimage data to be transferred to the print engine and others are storedand continuous printing operation is enabled.

In the meantime, a printer control method according to the presentinvention comprises a writing process for storing print data receivedfrom an external device in the auxiliary storage, a reading process forreading print data written to the auxiliary storage, a generationprocess for generating a request for printing based upon the read printdata and a printing process for printing based upon the above requestfor printing, and the above writing process is controlled so that it isperiodically executed by CPU even while the above generation process isexecuted by CPU. That is, priority is varied by a method such as timerinterrupt and efficient processing is extremely easily realized.

Further, a printer control method according to the present inventioncomprises a writing process for storing print data received from anexternal device in the auxiliary storage, a reading process for readingprint data written to the auxiliary storage, a generation process forgenerating a request for printing based upon the read print data and aprinting process for printing based upon the above request for printing,and the above writing process is controlled so that it is precedentlyexecuted by CPU in case the stored quantity of the requests for printinggenerated by executing the above generation process by CPU is equal topredetermined quantity. That is, according to a situation under which atask is processed, CPU can be efficiently allocated to each task thatdetermines the rate of the whole processing.

In the meantime, a medium that records a program according to thepresent invention is based upon a record medium that records a programfor operating the printer provided with the auxiliary storage and theprint engine by exclusively selecting and executing any of plural tasksaccording to priority, and is characterized in that the medium thatrecords a program according to the present invention is a record mediumthat records a program comprising a writing task for storing data in theauxiliary storage, a reading task for reading data stored in theauxiliary storage, an image generation task for generating a request forprinting supplied to the print engine and a printing task forcontrolling the print engine and controlling so that the above printingtask is most precedently executed, the print engine can be smoothlyoperated and particularly, if an engine of a laser printer is used,extremely prompt printing is also enabled.

Still further, a medium that records a program according to the presentinvention is based upon a record medium that records a program foroperating a printer provided with an auxiliary storage and a printengine by exclusively selecting and executing any of plural tasksaccording to priority, and is characterized in that the medium thatrecords a program according to the present invention is a record mediumthat records a program comprising a writing task for storing data in theauxiliary storage, a reading task for reading data stored in theauxiliary storage, an image generation task for generating a request forprinting supplied to the print engine and a printing task forcontrolling the print engine and controlling so that priority accordingto which the above writing task and the above image generation task areexecuted is varied according to a predetermined condition, CPU can beallocated to each task in a well-balanced state and efficient processingis enabled as the whole printer.

The above record medium also includes a memory such as RAM and ROM inaddition to a hard disk (HD), DVD-RAM, DVD-ROM a flexible disk (FD) andCD-ROM.

A program to be recorded on these media may be also sold with theprogram enciphered, with the program modulated or with the programcompressed via a wire circuit such as the Internet and a radio link orin a state in which the program is stored on a record medium.

Features and advantages of the invention will be evident from thefollowing detailed description of the preferred embodiments described inconjunction with the attached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

In the accompanying drawings:

FIG. 1 is an explanatory drawing schematically showing the configurationof a printer equivalent to an embodiment of the present invention;

FIG. 2 is a schematic diagram showing the flow of data inside theprinter equivalent to the first embodiment of the present invention;

FIG. 3 is a schematic diagram showing the flow of data from acommunication task to HD further in detail;

FIG. 4 is a flowchart showing processing by the communication task inthe configuration shown in FIG. 3;

FIG. 5 is a flowchart showing the processing of a task for writing toHD;

FIG. 6 is a schematic diagram showing the flow of data from HD to aprinting task further in detail;

FIG. 7 is a flowchart showing the processing of a task for reading fromHD;

FIG. 8 is a flowchart showing the processing of an image generationtask;

FIG. 9 is a conceptual drawing showing relationship among the priorityof each task in the printer according to the present invention;

FIG. 10 is a flowchart showing a case that the priority of the task forwriting to HD is periodically rewritten;

FIG. 11 is a time chart schematically showing a state in which each taskis executed when the priority is rewritten; FIG. 12 is a flowchartshowing processing for changing the priority of a task in a secondembodiment;

FIG. 13 is a schematic diagram showing the flow of data inside a printerequivalent to a third embodiment;

FIG. 14 is a schematic diagram showing the flow of data in a normalmode;

FIG. 15 is a schematic diagram showing the flow of data in a firstbypass mode;

FIG. 16 is a schematic diagram showing the flow of data in a secondbypass mode; and

FIGS. 17A and 17B are explanatory drawings showing a state in which atransfer mode is switched.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Referring to the drawings, embodiments of the present invention will bedescribed below.

First Embodiment

FIG. 1 is an explanatory drawing schematically showing the configurationof a printer equivalent to an embodiment of the present invention. Aprinter is provided with interfaces 1 and 2, CPU 3, RAM 4, ROM 5, anengine controller 8, a print engine 9 and an auxiliary storage 10. Acase using HD for an example of the auxiliary storage 10 will bedescribed below.

The interfaces 1 and 2, CPU 3, RAM 4, ROM 5 and HD 10 are connected viaa bus 6 and the engine controller 8 is connected to the bus 6 via theinterfaces 2 and 7. CPU 3 communicates data with an external network 100such as LAN via the interface 1 and communicates data with the enginecontroller 8 via the interface 2.

CPU 3 acts as an arithmetic processing unit and exclusively selects andexecutes any of plural tasks (also called processes). That is, CPU 3exclusively selects and executes any of a communication task 11, a taskfor writing to HD 12, a task for reading from HD 13, an image generationtask 14 and a printing task 15 as shown in FIG. 1. In addition to thesetypical tasks, various tasks not shown such as an idle task forrealizing an idle state of a printer and a control task for executingerror processing are provided.

The switching of tasks, that is, to which task CPU is allocated iscontrolled by a scheduler 17 which can be represented as a switchingcontrol section. The scheduler 17 is provided with a priority table 18and a priority changing section 19 for changing the priority of eachtask. In the priority table 18, data corresponding to the priority ofeach task 11 to 15 is stored. The priority changing section 19 fills arole of suitably changing the priority of each task and rewriting datain the priority table 18 as described in detail later. The scheduler 17allocates CPU to any of each task 11 to 15 according to priority storedin the priority table 18.

More concretely, each task including the printing task and thecommunication task is placed in an execution queue using a preset eventas a trigger and is sequentially executed after it is scheduledaccording to priority. That is, these tasks become executable when anevent occurs and a task the priority of which is the highest ofexecutable tasks is executed by CPU 3. For the above event, there areexternal interruption, timer interrupt and others.

The communication task 11 acts as a communications processor unit andwhen a packet is sent from the network 100, the unit is activated viaCPU. The communication task 11 deletes extra data such as an IP addressfrom the received packet and extracts print data. The print data isstored until a predetermined memory block provided to RAM 4 is filled.The communication task 11 is dormant when the storage of the print datais finished. As described later, a memory block in which data is storedis passed to the task for writing to HD 12.

The communication task 11 can be composed of plural tasks correspondingto each protocol such as a file transfer protocol (FTP) and a lineprinter protocol (LPP).

The task for writing to HD 12 acts as a processor for writing to HD andwrites data input from the communication task 11 via the memory block ofRAM 4 to HD 10 as described later.

The task for reading from HD 13 acts as a processor for reading from HD,reads data stored in HD 10, stores it in a memory block provided to RAM4 and transfers it to the image generation task 14.

The image generation task 14 acts as a print image generator and isactivated when a memory block in which data is stored is passed. Theimage generation task 14 reads print data in the memory block of RAM 4,generates a request for printing and passes the generated request forprinting to the printing task 15. When all print data is read, the imagegeneration task is dormant.

A request for printing is also called printing request structure andincludes the specification of paper size, of the number of copies (thenumber of printed copies) and of whether a printed place is the surfaceor the back of paper and the information of all image data and othersincluded in the page. That is, all the information of paper and imagesrespectively required for printing the page is acquired by analyzing arequest for printing.

The image generation task 14 is not composed of tasks respectivelycorresponding to plural printing languages but can be a single taskcorresponding to one printing language. Normally, one print job isdescribed by one type of printing language and when a print job isswitched, a task in printing language corresponding to the print job hasonly to be activated. As described above, a print job can be promptlyprocessed by composing the image generation task 14 by a task in singleprinting language.

However, the image generation task 14 is not limited to this and may bealso composed of plural tasks. In the case of printing languagerequiring high-grade processing such as a trade name “PostScript”, if arequest for printing is generated by the cooperative operation of pluraltasks, the efficiency of processing is more enhanced.

The printing task 15 acts as a printing executing section. That is, theprinting task is activated when a request for printing is input from theimage generation task 14, reads image data included in the request forprinting and drives the engine controller 8. The engine controller 8drives the print engine 9 and prints. When the engine controllerfinishes all printing control processing based upon the request forprinting, it becomes dormant.

The idle task 16 is a task executed for waiting for an event. The lowestpriority is applied to the idle task and if no task described above isexecuted, the idle task is executed.

For example, immediately after the printer is powered on or afterprinting is finished, the idle task is executed.

The print engine 9 includes a paper feeding mechanism, a print head andothers and executes printing on a print medium such as paper.Concretely, various engines respectively corresponding to a page printerfor printing in units of page, a serial printer for executing printingevery predetermined bandwidth, a line printer for printing every lineand others can be used.

For an example of a page printer, a so-called laser printer which isprovided with a laser beam source or an LED light source and which canexecute printing by electrophotography via a photoconductive drum can begiven. For an example of a serial printer, a so-called ink-jet printerand a so-called thermal printer can be given. The engine controller 8and the print engine 9 can be respectively also represented as printingmeans and a printing mechanism or a printing section.

FIG. 2 is a schematic diagram showing the flow of data inside theprinter equivalent to this embodiment. That is, the configuration shownin FIG. 2 is equivalent to an example that HD 10 is provided between thecommunication task 11 and the image generation task 14. Data transferbetween the communication task 11 and the task for writing to HD 12 isperformed via a first buffer memory 4 a and data transfer between thetask for reading from HD 13 and the image generation task 14 isperformed via a second buffer memory 4 b. In HD 10, three types of filesof a file data in which is being written by the task for writing to HD12, a file already written and waiting for processing and a file data inwhich is read by the task for reading from HD 13 may exist. These threetypes of files are equivalent to data being processed or residual data.

FIG. 3 is a schematic diagram showing the flow of data from thecommunication task 11 to HD 10 further in detail. That is, thecommunication task 11 deletes extra data such as header information froma received packet and stores data until an empty memory block of thefirst buffer memory 4 a is filled. The task for writing to HD 12extracts data from a memory block 21 when the memory block 21 not emptyis received and writes data to an empty file inside HD 10. The memoryblock 21 from which data is extracted is returned to the first buffermemory 4 a.

FIG. 4 is a flowchart showing processing by the communication task 11 inthe configuration shown in FIG. 3. The communication task 11 isactivated in a step S101 when packet data is received from the network100. Next, in a step S102, it is checked whether an empty memory block21 exists in the first buffer memory 4 a or not. If an empty memoryblock 21 exists in the step S102, one empty memory block 21 is extractedfrom the first buffer memory 4 a and data is stored in the memory block21 in a step S103. If no empty memory block 21 exists in the firstbuffer memory 4 a, processing is returned to the step S102 because nodata can be stored. When data is stored in the first buffer memory 4 ain the step S103, processing is returned to the step S101 and waits.

Next, FIG. 5 is a flowchart showing the processing of the task forwriting to HD 12. First, it is checked whether empty capacity exists inHD 10 or not in a step S111. If empty capacity exists in HD 10, data canbe transferred to HD 10. If it is checked in a step S112 whether anempty memory block 21 exists in the first buffer memory 4 a or not andit is checked in a step S113 whether the communication task 11 receivesthe next print job and requires an empty memory block 21 or not. If noempty memory block 21 exists in the first buffer memory 4 a and thecommunication task 11 requires a new empty memory block 21, data isextracted from a memory block 21 not empty and a file is written to HD10 in a step S114 to generate an empty memory block 21. The memory block21 from which data is extracted is returned to the first buffer memory 4a in a step S115. Hereby, the communication task 11 can store packetdata newly received in the memory block 21.

If no empty capacity exists in HD 10 in the step S111, processing waitsbecause no data can be transferred to HD 10. FIG. 6 is a schematicdiagram showing the flow of data from HD 10 to the printing task 15 indetail. That is, the task for reading from HD 13 reads data from a filein HD 10 and stores the data until an empty block of the second buffermemory 4 b is filled. When the image generation task 14 receives amemory block not empty, it extracts data from the memory block,generates a request for printing and returns the empty memory block fromwhich the data is extracted. The request for printing generated by theimage generation task 14 is stored in a buffer 4 c between the imagegeneration task and the printing task 15.

A print engine control section 15 a and a buffer control section 15 bare provided to the printing task 15. The print engine control section15 a reads the request for printing stored in the buffer 4 c and drivesthe engine controller 8 based upon the request for printing to executeprinting. The buffer control section 15 b controls the buffer 4 c. Whenprinting based upon the supplied request for printing is finished, theprint engine control section 15 a informs the buffer control section 15b of it and the buffer control section 15 b clears the request forprinting stored in the buffer 4 c.

FIG. 7 is a flowchart showing the processing of the task for readingfrom HD 13. First, it is checked in a step S121 whether an empty memoryblock exists in the second buffer memory 4 b or not. Next, it is checkedin a step S122 whether a residual file exists in HD 10 or not. If noempty memory block exists in the second buffer memory (NO in the stepS121) or if no file to be read exists in HD 10 (NO in the step S122),processing is returned to the step S121 and waits because no data can betransferred. In the meantime, if the steps S121 and S122 are judged asYES, an empty memory block in the second buffer memory 4 b is extractedand data read from a file in HD 10 is written to the memory block in astep S123.

Next, FIG. 8 is a flowchart showing the processing of the imagegeneration task 14. First, it is determined in a step S131 whether amemory block not empty exists in the second buffer memory 4 b or not. Ifa memory block not empty exists in the second buffer memory 4 b (YES inS131), one memory block not empty is extracted from the second buffermemory 4 b, data is read and a request for printing is generated in astep S132. The memory block from which the data is extracted is returnedto the second buffer memory in a step S133.

If a resource which a task requires cannot be secured even if the aboveeach task is executable by CPU 3, CPU 3 is allocated to anotherexecutable task. For example, in the communication task, a case that nopacket destined for the communication task is sent from a network(packets having various destinations flow in a network and a packetdestined for the communication task often intermittently arrives) and acase that there is no memory block for storing a received packet can begiven.

Also, in the printing task, a case that no request for printing to beprocessed exists and a case that a work memory becomes full can begiven. Further, in the case of the printing task, a case that a partprinted by the print engine becomes a part where no image data existsand no data to be processed exists and a case that printing becomes awaiting state by a part of a margin of paper and paper feeding timingcan be also given.

In the present invention, the above each task is executed according toeach priority and if a predetermined event occurs, the priority of aspecific task is changed. That is, priority is allocated to each taskand each task is executed according to the priority. If a predeterminedevent occurs while a certain task is executed, the priority of the taskfor writing to HD 12 and the task for reading from HD 13 is relativelyenhanced and each task is executed even if either of the task forwriting to HD 12 or the task for reading from HD 13 has low prioritycorresponding to the above event.

FIG. 9 is a conceptual drawing showing an example of relationship amongthe priority of each task in the printer according to the presentinvention. That is, FIG. 9 shows a case of a laser printer, and thepriority of a communication task 11 is set so that it is higher thanthat of an image generation task 14 and the priority of thecommunication task 11 is lower than that of a printing task 15.Therefore, if a packet is received during the generation of a requestfor printing, the communication task 11 is executed prior to the imagegeneration task, however, during the execution of the printing task 15,the communication task 11 is not executed even if a packet is receivedfrom the network 100.

In the meantime, in the present invention, the priority of the task forwriting to HD 12 and the priority of the task for reading from HD 13 aredynamically changed. Specifically, the priority of the task for writingto HD 12 and the task for reading from HD 13 and the priority of theimage generation task are reversed every predetermined time interval.

The above change of priority is executed by the priority changingsection 19 shown in FIG. 1. That is, if a predetermined event occurs,the priority changing section 19 rewrites the priority of predeterminedtasks stored in the priority table 18.

The above change of priority can be performed by instructing thescheduler 17 of CPU 3 to execute timer interrupt processing for example.Or the priority of tasks having higher priority in which CPU isallocated may be periodically also changed.

A reason why the priority of the printing task 15 is set so that it isthe highest as shown in FIG. 9 is that in the laser printer, when theprint engine is intermittently operated, the loss of rise time occursand it is the most efficient processing to continuously operate theprint engine. The above will be described in detail later.

In the meantime, in the case of a so-called serial printer such as anink-jet printer, even if a print engine is intermittently operated, noloss of rise time occurs. Therefore, the priority of a printing task 15is not necessarily required to be uppermost.

That is, the major object of the present invention is to dynamicallychange the priority of the task for writing to HD so that it is higherthan the priority of any other task. Therefore, it is desirable that thepriority of the printing task, the communication task and the imagegeneration task is suitably changed according to the format of aprinter.

A case that the priority of the task for writing to HD and the imagegeneration task is changed will be described below.

FIG. 10 is a flowchart showing a case that the priority of the task forwriting to HD 12 is periodically rewritten. That is, when processing isstarted, first, processing waits by predetermined time X in a step S1.The above time X is approximately 10 seconds. When predetermined time Xelapses, the priority of the task for writing to HD 12 is rewritten sothat it is higher than the priority of the image generation task 14 in astep S2. That is, the priority changing section 19 sets so that thepriority of the task for writing to HD 12 stored in the priority table18 is lower than the priority of the image generation task 14. If thepriority of the image generation task 14 is set to 146 for example, thepriority of the task for writing to HD 12 is rewritten so that it is147.

Next, processing waits by predetermined time Y in a step S3. The time Ymay be set to approximately 50 seconds. When predetermined time Yelapses, the priority of the task for writing to HD 12 is set in a stepS4 so that it is higher than the priority of the image generation task14. If the priority of the image generation task 14 is set to 146 forexample, the priority of the task for writing to HD 12 is rewritten sothat it is 145.

FIG. 11 is a time chart schematically showing a state in which each taskis executed when priority is rewritten as described above. That is, asshown in FIG. 11, in a predetermined period X, the priority of the taskfor writing to HD is set so that it is higher than the priority of theimage generation task and in a predetermined period Y, the priority ofthe task for writing to HD is set so that it is lower than the priorityof the image generation task. There is a period of timer interruptbetween these periods X and Y, however, the above period is momentarytime shorter than one second and is as short time as cannot be comparedwith the periods X and Y. In addition, when predetermined time comes,the allocation of CPU is forcedly lost.

Though the priority of the task for reading from HD is not shown in FIG.11, it may be also changed as the task for writing to HD.

In FIG. 11, four types of typical situations A to D are shown in ahorizontal direction corresponding to whether an event occurs in eachtask or not. These situations A to D correspond to whether an eventoccurs in each task or not shown in a table in FIG. 11.

First, the situation shown by a letter A in FIG. 11 shows a case that anevent which the task for writing to HD should process, that is, data tobe written to HD is input and an event which the image generation taskshould process, that is, print data is input.

In this case, as the priority of the task for writing to HD is setduring the period X so that it is higher than the priority of the imagegeneration task, the allocation of CPU is transferred to the task forwriting to HD and data is written to HD. Next, as the priority of thetask for writing to HD is set when the period Y comes so that it islower, the allocation of CPU is transferred to the image generation taskand a job of the generation of a request for printing and others isexecuted in the image generation task.

Next, the situation shown by a letter B in FIG. 11 shows a case thatthere is an event which the task for writing to HD should process andthere is no event which the image generation task should process. Inthis case, as the priority of the task for writing to HD is set at thebeginning of the period Y so that it is low, CPU is allocated to theimage generation task, however, as there is no event to be processed inthe image generation task, CPU is allocated to the task for writing toHD and data is written to HD. In the succeeding period X, as thepriority of the task for writing to HD is set so that it is higher thanthe priority of the image generation task, a state in which CPU isallocated to the task for writing to HD is kept and data is written toHD.

Next, the situation shown by a letter C in FIG. 11 shows a case thatthere is no event which the task for writing to HD should process andthere is an event which the image generation task should process. Inthis case, as the priority of the task for writing to HD is set in theperiod Y so that it is low, CPU is allocated to the image generationtask and a job of the generation of a request for printing and others isexecuted in the image generation task. In the succeeding period X, asthere is no event to be processed in the task for writing to HD thoughthe priority of the task for writing to HD is set so that it is higherthan that of the image generation task, the allocation of CPU istransferred to the image generation task and the processing of thegeneration of a request for printing and others is executed.

Next, the situation shown by a letter D in FIG. 11 shows a case thatthere is no event to be processed both in the task for writing to HD andin the image generation task. In this case, in the periods Y and X, CPUis allocated to the idle task and a waiting state is kept.

According to the present invention, CPU can be efficiently allocated toeach task by dynamically changing the priority of the task for writingto HD 12 as described above. As a result, the print engine can beefficiently operated and a host computer connected to the network can bereleased early.

To explain a case that the engine of a laser printer is used for theprint engine as an example, it is desirable that the engine iscontinuously operated without stopping it possibly to realize promptprinting. The reason is that once the operation of the engine isstopped, an extra step such as the heating of a fixing head is requiredbefore the engine is next activated and the loss of time is caused.Therefore, to keep printing speed at a maximum, it is required that theimage generation task 14 continuously outputs a request for printing tothe printing task 15 so that the engine can be continuously operated.

In the meantime, to release a host computer connected to the network 100early, it is desirable that data received by the interface 1 is promptlywritten to HD.

Therefore, to make prompt printing work and the prompt release of a hostcomputer compatible, it is required that the allocation of CPU isbalanced between the task for writing to HD and the image generationtask. However, if the priority of the task for writing to HD is set sothat it is always lower than the priority of the image generation task,the writing of data to HD is delayed and the release of the hostcomputer is delayed.

Particularly, when the image generation task once finishes importantprocessing of inputting print data and generating a request forprinting, it is often programmed so that processing called garbagecollection for example is started. The above garbage collection meansprocessing for collecting memory areas used as if they are worm-eatenand improving the efficiency of the utilization of a work memory,however, the priority of the processing is not high so much originally.That is, if a part of time in which the image generation task shouldexecute garbage collection is allocated to the task for writing to HD 12and data is written to HD, a host computer in the network can bereleased early without reducing printing speed.

According to these inventors' own examination, particularly when thepriority of the task for writing to HD for the image generation task ischanged, it proves that there is a tendency that printing processing andthe release of a host computer are compatible.

In this case, the priority of the task for reading from HD 13 may bealso changed at the same time as the priority of the task for writing toHD is changed if necessary. However, it proves that it is desirable thatthe priority of the task for reading from HD 13 is higher than thepriority of the task for writing to HD 12. This is because generally,speed for reading data from HD or an auxiliary storage such as anoptical disk and a magneto-optic disk is faster than speed for writingto them. That is, if the priority of the task for writing to HD is setso that it is higher than the priority of the task for reading from HD,the task for reading data is started after the task for writing data theprocessing speed of which is slow is finished, the rate of readingprocessing is limited and a situation that the quantity of data storedin HD temporarily overflows may also occur.

In the meantime, as long as the priority of the task for reading from HDis set so that it is higher than the priority of the task for writing toHD, the rate of processing for reading data from HD is not limited byprocessing the speed of which is slow and the smoothness of processingis kept.

The case that the priority of the task for writing to HD and the imagegeneration task is changed every predetermined time has been describedabove as the example.

Second Embodiment

Next, a second embodiment of the present invention will be described.

In this embodiment, the priority of each task is rewritten not everypredetermined time but according to a situation of the processing of thetask.

FIG. 12 is a flowchart showing processing for changing the priority of atask in this embodiment. That is, in an example shown in FIG. 12, thepriority of a task for writing to HD is changed according to the numberof unprocessed requests for printing.

As described above in relation to FIG. 6, a printing task 15 reads arequest for printing stored in a buffer 4 c and executes printing.Therefore, as printing is continuously executed without stopping for awhile in case the enough number of requests for printing is alreadystored in the buffer 4 c, it is more efficient to execute processing forwriting to HD and for reading from HD than to generate more requests forprinting. In processing shown in FIG. 12, the number of unprocessed onesof requests for printing is first detected in a step S11 and it isdetermined whether the number is larger, compared with a predeterminednumber n or not.

If the number of the unprocessed requests for printing is larger thanthe predetermined number n, an image generation task is not required togenerate more requests for printing hastily. Then, in a step S12, thepriority of the task for writing to HD is made higher than that of theimage generation task. Specifically, if the priority of the imagegeneration task is 146 for example, the priority of the task for writingto HD is 145. This is executed by rewriting a priority table by CPU.

In the meantime, if the number of unprocessed requests for printing issmaller than the above predetermined number n, it is desirable that theimage generation task continues to generate more requests for printingso as to continuously operate a print engine. Then, in a step S13, thepriority of the task for writing to HD is rewritten to 147 so as to makethe image generation task precede.

It is desirable that the above series of steps are repeatedly executedin accordance with the proceedings of processing in the printing task.The priority of the task for reading from HD may be also changed at thesame time as the change of the priority of the task for writing to HD.However, in this case, as described above, it is desirable that thepriority of the task for reading from HD is set so that it is alwayshigher than the priority of the task for writing to HD.

Further, in addition to the above judgment, the upper limit may be alsoprovided so that the setting of the same priority does not continuelonger than fixed time.

According to this embodiment, as the priority of the task for writing toHD is changed according to the stored quantity of requests for printinggenerated by the image generation task, data can be efficiently writtento HD without stopping the print engine. Particularly, the print enginecan be further continuously operated by changing the priority accordingto the stored quantity of requests for printing. As a result, smoothprinting, the receiving and writing of data can be balanced and a hostcomputer can be released early without reducing printing speed.

The case that the priority of the task for writing to HD 12 is changedaccording to the number of unprocessed requests for printing has beendescribed above as the example. However, the present invention is notlimited to the above case. In addition, the priority of a task may bealso changed according to the quantity of image data included inunprocessed requests for printing. Or the priority of the task forwriting to HD 12 for a communication task 11 may be also changedaccording to the number of unprocessed requests for printing. Forexample, if speed for receiving from a network is very fast, the rate ofprocessing for writing to HD 10 is limited and the whole processing maybe also delayed. In such a case, it is efficient to make the priority ofthe task for writing to HD 12 higher than that of the communication task11 and promote writing to HD.

Further, in this case, the priority of the task for reading from HD 13may be also changed at the same time as the task for writing to HD 12.The reason is that it realizes efficient processing to promote bothwriting and reading to/from HD 10 so that high speed receiving by thecommunication task 11 can be supported.

The second embodiment of the present invention has been described above.

Third Embodiment

Next, a third embodiment of the present invention will be described.

In this embodiment, further efficient processing is realized bybypassing at least either of a task for writing to HD or a task forreading from HD according to a situation in addition to the change ofthe priority of a task described in the first and second embodiments.

FIG. 13 is a schematic diagram showing the flow of data inside a printerequivalent to this embodiment. In this embodiment, as shown in FIG. 13,a first bypass line 31 and a second bypass line 32 are provided. As forthe first bypass line 31, a task for writing to HD 12, HD 10 and a taskfor reading from HD 13 are skipped and data is directly transferred to asecond buffer 4 b from a communication task 11. As for the second bypassline 32, HD is skipped and data is directly transferred to the secondbuffer 4 b from the task for writing to HD 12.

In the above configuration, in a normal mode (in a mode via an auxiliarystorage) in which no bypass line is passed, received data is stored inHD 10 via the communication task 11, a first buffer memory 4 a and thetask for writing to HD 12 and the data is input to an image generationtask 14 via the task for reading from HD 13 and the second buffer memory4 b.

FIG. 14 is a schematic diagram showing the flow of data in the normalmode. In this process, as in the above first or second embodiment, thepriority of the task for writing to HD 12 for the image generation task14 is changed. Hereby, in the normal mode, printing is promptly executedand a host computer can be released early. Particularly, in the normalmode, if mass data is sent via a network, effect is produced. Recently,the throughput of a computer is enhanced, the performance of aperipheral device such as an image input device is enhanced or alarge-scale network is developed, and the huge increase of print dataand the increase of a load upon the printer rapidly advance.

Therefore, it is extremely effective to efficiently store print data ina mass auxiliary storage in such a normal mode.

FIG. 15 is a schematic diagram showing the flow of data in a firstbypass mode via the first bypass line. In this mode, as received data isdirectly stored in a memory block of the second buffer memory, theprocessing of the task for writing to HD 12 and the task for readingfrom HD 13 is omitted and data can be promptly input to the imagegeneration task 14.

FIG. 16 is a schematic diagram showing the flow of data in a secondbypass mode via the second bypass line. In this mode, as the task forwriting to HD 12 stores data in a memory block of the second buffermemory 4 b in place of writing data to HD 10, data can be promptlytransferred to the image generation task 14.

FIGS. 17A and 17B are schematic diagrams showing the appearance of thechange of a transfer mode caused when one print job is transferred.

For example, as shown in FIG. 17A, at the beginning of the receiving ofa print job, transfer is performed in the first bypass mode. Then, whenthe communication task 11 uses up a memory block of the second buffermemory 4 b, received data is stored in a memory block of the firstbuffer memory 4 a. While the communication task 11 uses the first buffermemory 4 a, the image generation task 14 receives a memory block notempty from the second buffer memory 4 b and generates a request forprinting. As described above, when a full memory block occurs in thefirst buffer memory 4 a under a situation that no residual file exists(as determined by the residual file detector 23) in HD 10, the firstbypass mode is switched to the second bypass mode by the task forwriting to HD 12. In the second bypass mode, the task for writing to HD12 stores data in a memory block of the second buffer memory 4 b. Whenthere is no empty memory block in the second buffer memory 4 b byswitching to the second bypass mode, the second bypass mode is switchedto the mode via the auxiliary storage (the normal mode) and data isinput to the image generation task 14 via HD 10. In the normal mode, thepriority of the task for writing to HD 12 for the image generation task14 is changed as in the first or second embodiment.

Therefore, according to this embodiment, high speed data transfer in thefirst and second bypass modes is performed immediately after a print jobis received, the first and second bypass modes are switched to thenormal mode in the vicinity of the middle of the print job and in thisstep, smooth printing and the early release of a host computer are alsocompatible. As all files in HD 10 are read around the end of the printjob, the normal mode is switched to the second bypass mode. Then, thesecond bypass mode is switched to the first bypass mode.

In this embodiment, in all print jobs, mode switching shown in FIG. 17Ais not performed. A situation of mode switching also changes accordingto the change of various parameters such as speed for receiving apacket, the quantity of data included in a print job and the processingspeed of the image generation task 14.

For example, as shown in FIG. 17B, a case that the first bypass mode isswitched to the mode via the auxiliary storage (the normal mode) is alsoconceivable. In this case, smooth processing is also realized bydynamically changing the priority of a task in the normal mode.

Referring to the concrete drawings, the embodiments of the presentinvention are described above. However, the present invention is notlimited to these concrete examples.

For example, in the above each concrete example, the case that thepriority is changed according to timer interrupt or the number ofunprocessed requests for printing is shown, however, in addition, thepriority of the task for writing to HD may be also changed according toa situation of the processing of any task. That is, according to thepresent invention, as a result, the relative priority of the task forwriting to HD for another task has only to be changed. Therefore, forexample, the priority of the image generation task or another task maybe also rewritten in place of changing the priority of the task forwriting to HD or at the same time as it.

The above case that print data received from the network 100 is storedin HD 10 is given as the example; however, in addition, for example, arequest for printing generated by the image generation task may be alsostored in HD 10. In this case, the request for printing generated by theimage generation task 14 is stored in HD 10 by the task for writing toHD 12. Data read by the task for reading from HD 13 is transferred to aprinting task 15.

As the quantity of data included in a request for printing isparticularly much of data generated by the image generation task, it isefficient to store the request for printing in HD.

However, when the image generation task sequentially continues togenerate a large quantity of requests for printing in suchconfiguration, receiving a large quantity of print data via the network,the writing of data to HD does not catch up and a situation that thetransfer of data is delayed may occur. In such a case, if the priorityof the task for writing to HD is suitably set so that it is higher thanthe priority of the image generation task, the transfer of a request forprinting to HD is secured and the processing of the whole printer can besmoothly executed.

In the meantime, in the present invention, various recording devices notlimited to HD using a record medium such as an optical record medium anda magneto-optic record medium can be used for the auxiliary storage.That is, if a recording device the speed for writing data of which isslower than a conventional type buffer memory, that is, RAM is used forthe auxiliary storage, the present invention is similarly applied andthe similar effect can be acquired.

In the meantime, the size of a memory block which is the unit of the useof each buffer memory can be changed according to a state in which datais processed. For example, the size of a memory block can be also set toa fixed value of approximately 100 kB and block size can be also changedaccording to a data processing rate inside the printer. The size of amemory block of each buffer memory is not necessarily required to beequal and may be also different. However, if block size is the same, itis convenient in view of data transfer.

Further, the printer according to the present invention is not limitedto a printer dedicated device and may be also a compound device providedwith another function such as a copying machine and a facsimile.

In addition, this trade can add and change variously in the range of thesummary of the present invention disclosed in this specification.

The present invention is embodied in the above embodiments and thefollowing effect is produced.

First, according to the first embodiment of the present invention, ifdata is written to HD, a host computer in a network can be releasedearly without reducing printing speed by changing the priority of thetask for writing to HD by timer interrupt.

Particularly, the balance of plural tasks can be improved by allocatinga part of processing time such as garbage collection by the imagegeneration task to the task for writing to HD.

Also, according to the second embodiment of the present invention, asthe priority of the task for writing to HD is changed according to asituation such as the stored quantity of requests for printing generatedby the image generation task, data can be efficiently written to HDwithout stopping the print engine.

Particularly, the continuous operation of the print engine can besecured by changing the priority according to the stored quantity ofrequests for printing. As a result, smooth printing, the smoothreceiving of data and smooth writing can be balanced and a host computercan be released early without reducing printing speed.

The effect produced by the present invention is particularly remarkablein case the engine of a laser printer is used. That is, it is desirablethat the laser printer is continuously operated without stopping theengine possibly so as to realize prompt printing; however, according tothe present invention, the priority of the task for writing to HD isadjusted, storing requests for printing so that the engine can becontinuously operated.

In the meantime, according to the third embodiment of the presentinvention, as the bypass lines are further provided and the normal modevia HD and the bypass mode for bypassing HD are switched according to astate in which data is processed, processing time can be more greatlyreduced than that in case the whole print job is stored in HD.Simultaneously in the normal mode, efficient processing is enabled bydynamically adjusting the priority of a task as in the first or secondembodiment. As a result, further high speed processing by the bypassmode is enabled in addition to prompt printing in the normal mode andthe release of a host computer and the usability of the printer isfurther improved.

Further, according to the above each embodiment of the presentinvention, the processing speed of the whole printer can be enhancedwithout using a high-priced high speed interface, DMA and others.

As described in detail above, according to the present invention, theprinter the cost of which is low and which is extremely usable can beprovided and industrial merits are great.

1. A printer provided with an auxiliary storage, comprising: a printingtask for executing processing related to the control of a print engineaccording to a request for printing; an image generation task forgenerating said request for printing based upon print data sent from anexternal device; a task for writing to the auxiliary storage, by whichdata related to printing is stored in said auxiliary storage; and a taskfor reading from the auxiliary storage, by which said data stored insaid auxiliary storage is read, wherein each of said tasks areexclusively selected and executed according to each priority, wherein arelative order of priority based upon the priority of said task forwriting to said auxiliary storage and the priority of said imagegeneration task is varied when a predetermined event occurs.
 2. Aprinter according to claim 1, wherein priorities lower than the priorityof said printing task is applied to said task for writing to saidauxiliary storage and said task for reading from said auxiliary storage.3. A printer according to claim 1, wherein said predetermined event is apredetermined elapse of time.
 4. A printer according to claim 1, whereinsaid predetermined event is an occurrence of a predetermined situationwhich occurs in a processing of any of tasks.
 5. A printer according toclaim 4, wherein said predetermined event is judgment that quantity ofrequests for printing generated by said image generation task and storedto be consumed by said printing task exceeds predetermined quantity. 6.A printer according to claim 1, wherein a priority lower than thepriority of said task for reading from said auxiliary storage is appliedto said task for writing to said auxiliary storage.
 7. A printercomprising: an auxiliary storage for storing data related to printing; aprint engine for executing printing; and a controller comprising:writing means for storing said data in said auxiliary storage; readingmeans for reading said data stored in said auxiliary storage; imagegeneration means for generating a request for printing supplied to saidprint engine; and printing execution means for controlling said printengine, wherein, if a predetermined event occurs during processing forgenerating said printing request by said image generation means, saidwriting mean is executed more precedently than a generation of saidrequest for printing by said image generation means.
 8. A printeraccording to claim 1, wherein said data related to printing stored insaid auxiliary storage includes print data sent from an external device.9. A printer according to claim 1, wherein said data related to printingstored in said auxiliary storage includes at least a part of saidrequest for printing.
 10. A printer control method, comprising: awriting process for storing print data as it is received from anexternal device in an auxiliary storage; a reading process for readingprint data written to said auxiliary storage; a generation process forgenerating a request for printing based upon said read print data; and aprinting process for printing based upon said request for printing,wherein said writing process is controlled so that it is periodicallyexecuted by CPU even while said generation process is executed by saidCPU.
 11. A record medium for recording a program for operating a printerprovided with an auxiliary storage and a print engine by exclusivelyselecting and executing any of plural tasks according to priority,wherein said program comprises: a writing task for storing data in saidauxiliary storage; a reading task for reading data stored in saidauxiliary storage; an image generation task for generating a request forprinting supplied to said print engine; a printing task for controllingsaid print engine; and wherein said printing task is controlled so thatit is most precedently executed.
 12. A record medium for recording aprogram for operating a printer provided with an auxiliary storage and aprint engine by exclusively selecting and executing any of plural tasksaccording to priority, wherein: said program comprises: a writing taskfor storing data in said auxiliary storage; a reading task for readingdata stored in said auxiliary storage; an image generation task forgenerating a request for printing supplied to said print engine; aprinting task for controlling said print engine; and wherein priorityaccording to which said writing task and said image generation task areexecuted is controlled so that it is varied according to a predeterminedcondition.
 13. A printer, comprising: an auxiliary storage; a printengine; printing tasks for controlling said print engine according torequests for printing; image generation tasks for generating saidrequests for printing based upon print data sent from an externaldevice, wherein said print data includes a plurality of pages; writingtasks for writing said print data to the auxiliary storage, by whichsaid print data is stored in said auxiliary storage; reading tasks forreading from the auxiliary storage, by which said print data stored insaid auxiliary storage is read; and a switching control section forassigning each of said tasks a relative order of priority, wherein eachof said tasks are exclusively selected and executed according to saidpriority of each of said tasks, wherein the relative order of saidpriority of each of said tasks which are unprocessed is varied when apredetermined event occurs, wherein a priority of unprocessed writingtasks and a priority of unprocessed reading tasks are lower than apriority of unprocessed printing tasks, and wherein a relative order ofpriority of said unprocessed writing tasks with respect to a priority ofunprocessed image generation tasks is dynamically varied when saidpredetermined event occurs.